#pragma once
#include "interfaces.h"
#include <map>
#include "ParserStack.h"

class TextParser : public IAssetParser
{
public:
	TextParser() { Stack.ptr_tosend = this; }
	~TextParser() { }

	ParserStack Stack;

	virtual void VBegin() = 0;
	virtual void VEnd() = 0;

	unsigned int file_ptr;
	bool text_mode;
	char * source; unsigned int size;
	virtual AssetDataList & VLoad( Resource & res, char * bfr, unsigned int sze );
	void ParseNext( char * param );
	void PreParseNext( char * param );
	void ParseNext( );
	void SkipFreeSpace();

	static bool IsLetter(const char n);
	static bool IsNumber(const char n);
	static bool IsInteger(const char * const n);
	static bool IsFloat(const char * const n);
	static bool IsDouble(const char * const n);
	static bool IsCapital(const char n);
	static bool IsEndChar(const char n);
	static bool IsFreeSpace(const char n);
	static bool AreEqual(const char * const a, const char * const b);
	static int CharToInt(const char * const n);

	virtual AssetDataList & VGetData() = 0;
};